package com.hejing.面向对象特征之三_多态.多态的测试案例;

/**
 * ClassName: GeometricObject
 * Package: com.hejing.面向对象特征之三_多态.多态的测试案例
 * Description:
 *      几何形状类
 * @Author: HeJing
 * @Create: 2023-03-26 15:47
 * @Version: 1.0
 */
public class GeometricObject {

    String name;
    protected String color;  // 颜色
    protected double weight; // 权重

    public GeometricObject(String color, double weight) {
        this.color = color;
        this.weight = weight;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public double getWeight() {
        return weight;
    }

    public void setWeight(double weight) {
        this.weight = weight;
    }

    // 父类为子类规定 求面积的方法
    public double getArea() {
        System.out.println("求取几何图形面积");
        return 0.0;
    }
}




















